package com.bieyang.anjia.ui.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.bieyang.anjia.R;

public class AcModify extends BaseActivity {
	Button btnBack;
	RelativeLayout rlSetExit, rlSetNews, rlSetYinsi, rlSetAbout, rlSetSafe;
	TextView tvTitle;
	EditText etNew;
	int parent;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.my_modify);

		tvTitle = (TextView) findViewById(R.id.tvTitle);
		etNew = (EditText) findViewById(R.id.etNew);

		String content = getIntent().getStringExtra("parent").split(":")[0];
		etNew.setText(getIntent().getStringExtra("parent").split(":")[1]);

		if ("modifyAnjia".endsWith(content)) {
			tvTitle.setText(R.string.modify_anjiahao);
		} else if ("modifyPhone".endsWith(content)) {
			tvTitle.setText(R.string.modify_phone);
		} else if ("rlmodifyEmail".endsWith(content)) {
			tvTitle.setText(R.string.modify_email);
		}

		// switch (parent) {
		// case 1:
		// tvTitle.setText(R.string.modify_anjiahao);
		// break;
		// case 2:
		// tvTitle.setText(R.string.modify_phone);
		// break;
		// case 3:
		// tvTitle.setText(R.string.modify_email);
		// break;
		//
		// default:
		// break;
		// }
		initView();

	}

	private void initView() {
		OnClick onClick = new OnClick();
		btnBack = (Button) findViewById(R.id.btnBack);
		btnBack.setOnClickListener(onClick);

		// rlSetExit = (RelativeLayout)findViewById(R.id.rlSetExit);
		// rlSetExit.setOnClickListener(onClick);
		//
		// rlSetNews = (RelativeLayout)findViewById(R.id.rlSetNews);
		// rlSetNews.setOnClickListener(onClick);
		// rlSetYinsi = (RelativeLayout)findViewById(R.id.rlSetYinsi);
		// rlSetYinsi.setOnClickListener(onClick);
		// rlSetAbout = (RelativeLayout)findViewById(R.id.rlSetAbout);
		// rlSetAbout.setOnClickListener(onClick);
		// rlSetSafe = (RelativeLayout)findViewById(R.id.rlSetSafe);
		// rlSetSafe.setOnClickListener(onClick);

	}

	class OnClick implements android.view.View.OnClickListener {
		@Override
		public void onClick(View v) {
			switch (v.getId()) {
			case R.id.btnBack:
				finish();
				break;
			case R.id.rlSetAbout:
				startActivity(new Intent(AcModify.this, AcAbout.class));
				break;
			case R.id.rlSetExit:
				// startActivity(new Intent(AcSetting.this,AcMobanYushe.class));
				Intent intent = new Intent();
				intent.setClass(AcModify.this, Exit.class);
				startActivity(intent);
				break;
			default:
				break;
			}

		}

	}

	@Override
	public boolean onKeyDown(int keyCode, KeyEvent event) {
		if (keyCode == KeyEvent.KEYCODE_BACK) {
			finish();
			return true;
		}

		return super.onKeyDown(keyCode, event);
	}

}